package com.ly.user_system.common;

import com.ly.user_system.utils.R;

public class ResponseUtils {
    /**
     * 成功响应
     */
    public static <T> R<T> success() {
        return R.ok();
    }

    public static <T> R<T> success(T data) {
        return R.ok(data);
    }

    public static <T> R<T> success(T data, String msg) {
        return R.ok(data, msg);
    }

    /**
     * 失败响应
     */
    public static <T> R<T> fail() {
        return R.fail();
    }

    public static <T> R<T> fail(String msg) {
        return R.fail(msg);
    }

    public static <T> R<T> fail(T data) {
        return R.fail(data);
    }

    public static <T> R<T> fail(T data, String msg) {
        return R.fail(data, msg);
    }

    public static <T> R<T> fail(int code, String msg) {
        return R.fail(code, msg);
    }

    /**
     * 自定义响应
     */
    public static <T> R<T> response(int code, String msg, T data) {
        return R.restResult(data, code, msg);
    }
}